import Vue from 'vue';
import Router from 'vue-router';
// import vue_resource from 'vue-resource';
import element_ui from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

const signin = r => require.ensure([], () => r(require('@/components/admin/signin.vue')), 'signin');
const rightsidebar = r => require.ensure([], () => r(require('@/components/rightsidebar.vue')), 'rightsidebar');
const sidebar = r => require.ensure([], () => r(require('@/components/sidebar.vue')), 'sidebar');
const article = r => require.ensure([], () => r(require('@/components/article.vue')), 'article');
const about = r => require.ensure([], () => r(require('@/components/about.vue')), 'about');
const articleDetail = r => require.ensure([], () => r(require('@/components/articleDetail.vue')), 'articleDetail');
const articleList = r => require.ensure([], () => r(require('@/components/admin/articleList.vue')), 'articleList');
const articleEdit = r => require.ensure([], () => r(require('@/components/admin/articleEdit.vue')), 'articleEdit');

// import signin from '@/components/admin/signin.vue';
// import sidebar from '@/components/sidebar.vue';
// import rightsidebar from '@/components/rightsidebar';
// import article from '@/components/article.vue';
// import about from '@/components/about.vue';
// import articleDetail from '@/components/articleDetail.vue';
// import articleList from '@/components/admin/articleList.vue';
// import articleEdit from '@/components/admin/articleEdit.vue';
import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';
import axios from 'axios';
Vue.prototype.$req = axios;
Vue.use(Router);
// Vue.use(vue_resource);
Vue.use(element_ui);
Vue.use(mavonEditor);

export default new Router({
  routes: [
    {
      path: '/',
      components: {
        default: article,
        sidebar: sidebar,
        rightsidebar: rightsidebar
      }
    }, {
      path: '/article',
      components: {
        default: article,
        sidebar: sidebar,
        rightsidebar: rightsidebar
      }
    }, {
      path: '/about',
      components: {
        sidebar: sidebar,
        default: about
      }
    }, {
      path: '/articleDetail/:id',
      components: {
        default: articleDetail,
        sidebar: sidebar
      }
    }, {
      path: '/admin/articleList',
      components: {
        default: articleList,
        sidebar: sidebar
      }
    }, {
      path: '/admin/articleEdit',
      component: articleEdit,
      sidebar: sidebar
    }, {
      path: '/admin/articleEdit/:id',
      component: articleEdit,
        sidebar: sidebar
    }, {
      path: '/admin/signin',
      component: signin
    }
  ]
});
